// constTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "string"

struct PEOPLE
{
	int Age;
	std::string Name;
};

int _tmain(int argc, _TCHAR* argv[])
{
	// pointer
	{
		char* const p = "Hello";
		const char* q = "World";
		char* o = "Everything";

		//p = q; // bad
		q = p; // good;
		o = p;

		p[0] = 'h';
		//q[0] = 'w'; // bad;
		o[0] = 'e';
	}

	// reference
	{
		PEOPLE m = { 30, "Miles" };

		PEOPLE& const p = m; // C4227, ignore const or volatile on reference
		const PEOPLE& q = m;
		PEOPLE& o = m;

		//q = m; // bad
		o = m;

		//q.Age = 20; // bad
		o.Age = 20;
	}


	return 0;
}

